﻿// Fill out your copyright notice in the Description page of Project Settings.


#include "GameMode/StartMenuGameMode.h"

#include "Character/PlayerCharacter.h"
#include "Kismet/GameplayStatics.h"

void AStartMenuGameMode::BeginPlay()
{
	Super::BeginPlay();
	if(GameStartWidgetClass)
	{
		UUserWidget* UserWidget = CreateWidget(GetWorld(), GameStartWidgetClass);
		if (UserWidget)
		{
			APlayerCharacter* PlayerPawn = Cast<APlayerCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
			if (PlayerPawn)
			{
				PlayerPawn->StopOperation();
			}
			UserWidget->AddToViewport();
			GameStartUI = Cast<UGameStartWidget>(UserWidget);
		}
	}
}
